<?php
declare (strict_types=1);

namespace app\common\model;

use think\facade\Cache;

class RafflePrize extends Base
{
    public static function getPrize(): array
    {
        $list = Cache::get('raffle_prize');
        if ($list) {
            $list = json_decode($list, true);
        } else {
            $list = parent::order('id asc')->column('id,title,icon,amount,odds,position', 'id');
            Cache::set('raffle_prize', json_encode($list));
        }

        return $list;
    }
}